# -*- coding: utf-8 -*-
class Solution(object):
    def maxArea(self, height):
        """
        :type height: List[int]
        :rtype: int
        """
        res, left, right = 0, 0, len(height) - 1
        while left < right:
            res = max(res, min(height[left], height[right]) * (right - left))
            if height[left] < height[right]:
                left += 1
            else:
                right -= 1

        return res


print(Solution().maxArea([1, 8, 6, 2, 5, 4, 8, 3, 7]))
